import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NZ_I18N, zh_CN } from 'ng-zorro-antd/i18n';
import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ShareModule } from './share.module';
import { NgxsRouterPluginModule } from '@ngxs/router-plugin';
import { NZ_CONFIG, NzConfig } from 'ng-zorro-antd/core/config';
import { NgxsModule } from '@ngxs/store';
import { AllStates } from './stores';
import { pageModule } from './page.module';

const nzConfig: NzConfig = {
    modal: {
        nzMask: true,
        nzMaskClosable: false
    },
    message: {
        nzDuration: 2500
    }
};
registerLocaleData(zh);

@NgModule({
    declarations: [AppComponent],
    imports: [
        BrowserModule,
        AppRoutingModule,
        FormsModule,
        HttpClientModule,
        BrowserAnimationsModule,
        ShareModule,
        pageModule,
        NgxsModule.forRoot([...AllStates]),
        NgxsRouterPluginModule.forRoot(),
    ],
    providers: [
        { provide: NZ_I18N, useValue: zh_CN },
        { provide: NZ_CONFIG, useValue: nzConfig }
    ],
    bootstrap: [AppComponent]
})
export class AppModule {}
